/* 消息组件样式 */
.message {
  margin: 0;
  max-width: 800px; /* 限制最大宽度，让消息不会太宽 */
  width: 100%;
}

/* 用户消息 - 左侧布局 */
.user-message {
  align-self: flex-start; /* 在居中容器内左对齐 */
  max-width: 70%;
}

.user-message .message-content {
  background: #4285f4;
  color: white;
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
}

.user-message .message-header {
  justify-content: flex-start;
  margin-bottom: 8px;
}

.user-message .sender-name {
  order: 1;
  margin-left: 8px;
}

.user-message .timestamp {
  order: 2;
  margin-left: auto;
}

/* AI消息 - 也靠左侧，但更宽 */
.ai-message {
  align-self: flex-end; /* 在居中容器内右对齐 */
  max-width: 95%;
}

/* 消息文本区域 */
.message-text {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 18px 18px 18px 4px;
  padding: 16px;
  margin-bottom: 12px;
}

/* 消息头部 */
.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

/* AI消息头部也靠左对齐 */
.ai-message .message-header {
  justify-content: flex-start;
}

.ai-message .timestamp {
  order: 3;
  margin-left: auto;
}

.ai-message .sender-name {
  order: 1;
  margin-left: 8px;
}

.ai-message .message-badge {
  order: 2;
  margin-left: 6px;
}

.ai-message .copy-button {
  order: 4;
  margin-left: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 8px;
}

.user-avatar {
  background: #4285f4;
  color: white;
}

.ai-avatar {
  background: #34a853;
  color: white;
}

.sender-name {
  font-weight: 600;
  color: #202124;
  font-size: 14px;
}

.message-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
  margin-left: 6px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.ai-badge {
  background: #e8f5e8;
  color: #34a853;
}

.timestamp {
  color: #9aa0a6;
  font-size: 12px;
  margin-left: auto;
}

.copy-button {
  background: none;
  border: none;
  color: #5f6368;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  margin-left: 8px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.copy-button:hover {
  background: #f1f3f4;
}

/* 消息内容 */
.message-content {
  word-wrap: break-word;
}

.text-content {
  line-height: 1.5;
  color: #202124;
  margin-bottom: 12px;
}

.text-content:last-child {
  margin-bottom: 0;
}

/* 数据Tabs容器 */
.data-tabs {
  margin-top: 12px;
}

/* Tab内容包装器 */
.tab-content-wrapper {
  position: relative;
}

.tab-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

/* 数据卡片 */
.data-card {
  background: #ffffff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.data-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: #4285f4;
}

/* 卡片头部 */
.card-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
  gap: 8px;
}

.card-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.card-title {
  font-weight: 600;
  color: #202124;
  font-size: 14px;
  flex: 1;
}

.card-meta {
  color: #5f6368;
  font-size: 12px;
  margin-left: auto;
  margin-right: 8px;
}

.card-actions {
  display: flex;
  gap: 4px;
}

.action-btn {
  background: none;
  border: none;
  color: #5f6368;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #e8eaed;
  color: #202124;
}

/* 卡片内容 */
.card-content {
  padding: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 特殊卡片样式 */
.chart-card .card-content {
  padding: 20px;
}

.table-card .card-content {
  padding: 0;
}

.code-card .card-content {
  padding: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .user-message {
    max-width: 85%;
    align-self: flex-start;
  }
  
  .ai-message {
    max-width: 95%;
    align-self: flex-end;
  }
  
  .message-text {
    padding: 12px;
  }
  
  .data-cards {
    gap: 12px;
  }
  
  .card-header {
    padding: 10px 12px;
  }
  
  .card-title {
    font-size: 13px;
  }
  
  .card-meta {
    font-size: 11px;
  }
  
  .chart-card .card-content {
    padding: 12px;
  }
}
